﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace DHM.IService {
    public interface IBaseService<T> where T : class, new () {
        Task<bool> AddAsync (T entity);
        Task<bool> DeleteAsync (T entity);
        Task<bool> UpdateAsync (T entity);
        Task<T> FindAsync (int id);
        Task<T> FindAsync (Expression<Func<T, bool>> func);

        Task<List<T>> QueryAsync ();

        Task<List<T>> QueryAsync (Expression<Func<T, bool>> func);

        Task<List<T>> QueryAsync (int page, int size, RefAsync<int> total);

        Task<List<T>> QueryAsync (Expression<Func<T, bool>> func, int page, int size, RefAsync<int> total);

        Task<List<T>> QueryAsyncOrder (Expression<Func<T, bool>> func, Expression<Func<T, object>> func2, OrderByType ordertype, int page, int size, RefAsync<int> total);

        Task<int> GetModuleCount (Expression<Func<T, bool>> func);
    }
}